from redis import StrictRedis


class Config:
    DEBUG = None

    # 设置秘钥
    SECRET_KEY = 'VBqAM4eaQTYymvUny1xLccwcfflNdYpQ4rnOE5x1wgeYW/5FCYBuFdNZT8kNVzPOJmw='

    # 配置数据库的链接
    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@localhost/info_news'
    # 配置动态修改
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    #定义redis配置的信息
    REDIS_HOST='127.0.0.1'
    REDIS_PORT='6379'
    # 配置状态保持中的session信息，存储在redis数据库中
    SESSION_TYPE = 'redis'
    SESSION_REDIS = StrictRedis(host=REDIS_HOST,port=REDIS_PORT)
    SESSION_USE_SIGNER = True
    PERMANENT_SESSION_LIFETIME = 86400


# 开发模式下的配置信息
class DevelopmentConfig(Config):
    DEBUG = True


class ProductionConfig(Config):
    DEBUG = False


dict_config = {
    'development': DevelopmentConfig,
    'production': ProductionConfig
}
